using Microsoft.Phone.Controls.Properties;
using System;
using System.Windows;
namespace Microsoft.Phone.Controls
{
	public class RoutedPropertyChangingEventArgs<T> : RoutedEventArgs
	{
		private bool _cancel;
		public DependencyProperty Property
		{
			get;
			private set;
		}
		public T OldValue
		{
			get;
			private set;
		}
		public T NewValue
		{
			get;
			set;
		}
		public bool IsCancelable
		{
			get;
			private set;
		}
		public bool Cancel
		{
			get
			{
				return this._cancel;
			}
			set
			{
				if (this.IsCancelable)
				{
					this._cancel = value;
					return;
				}
				if (value)
				{
					throw new InvalidOperationException(Resources.RoutedPropertyChangingEventArgs_CancelSet_InvalidOperation);
				}
			}
		}
		public bool InCoercion
		{
			get;
			set;
		}
		public RoutedPropertyChangingEventArgs(DependencyProperty property, T oldValue, T newValue, bool isCancelable)
		{
			this.Property = property;
			this.OldValue = oldValue;
			this.NewValue = newValue;
			this.IsCancelable = isCancelable;
			this.Cancel = false;
		}
	}
}
